<script setup lang="ts">
const emit = defineEmits(['done'])
const option = defineModel()

const form = reactive({
  accountUuid: '',
})
const formRules = reactive({
  accountUuid: [{ required: true, message: '请选择账户', trigger: ['blur', 'change'] }],
})
async function confirm() {
  if (!form.accountUuid) {
    ElNotification.warning('请选择账户')
    return
  }
  emit('done', { ...form })
  option.value.visible = false
}
</script>

<template>
  <el-dialog v-model="option.visible" :title="option.title" width="400px" append-to-body>
    <el-form :rules="formRules" :model="form">
      <el-form-item prop="accountUuid">
        <AccountSearch v-model="form.accountUuid" />
      </el-form-item>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="option.visible = false">取 消</el-button>
        <el-button type="primary" :disabled="!form.accountUuid" @click="confirm">确 定</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<style scoped lang='scss'>

</style>
